<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>本地存储sessionStorage(一)</title>
</head>
<body>
    <script>
        /**
         * 绘话存储 session和cookie
         */
        //存储 key-val形式  key:username val:abc
        //sessionStorage.setItem('username','abc');
        //sessionStorage.setItem('logintime','2022-05-04');
        //取值
        let username = sessionStorage.getItem('username');
        console.log(username);
        //单独删除某一个key的值
        //sessionStorage.removeItem('username');

        //全部删除
        //sessionStorage.clear();

        //生命周期：关闭浏览器窗口，存的值不存在了
        


    </script>
</body>
</html>